#define _CRT_SECURE_NO_WARNINGS 1
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
    string longestCommonPrefix(vector<string>& strs)
    {
        string ret;
        if (strs.size() == 0) return ret;
        ret = strs[0];
        if (strs.size() == 1) return ret;
        for (int i = 0;i < strs.size();++i)
        {
            for (int j = 0;j < ret.size();++j)
            {
                if (ret[j] != strs[i][j])
                {
                    ret.erase(j);
                }
            }
        }
        return ret;
    }
};